package util;

import java.util.Random;

import org.lwjgl.opengl.GL11;

public class Point extends Drawable {
	public float x;
	public float y;
	public float z;
	Random rand = new Random();
	public boolean visible = true;
	
	public Point (float x, float y, float z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	public Point addVectorToPoint(Vector v) {
		this.x += v.x;
		this.y += v.y;
		this.z += v.z;
		return this;
	}
	
	public Point subtractVectorFromPoint(Vector v) {
		this.x -= v.x;
		this.y -= v.y;
		this.z -= v.z;
		return this;
	}
	
	public Vector subtractPointFromPoint(Point p) {
		return new Vector(this.x - p.x, this.y - p.y, this.z - p.z);
	}
	
	public void setPointToPoint(Point p) {
		x = p.x;
		y = p.y;
		z = p.z;
	}
	
	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	
	@Override
	public void draw() {
		if(!visible) {
			return;
		}
		GL11.glColor3f(1f, 1f, 1f);
		GL11.glPushMatrix();		
		GL11.glBegin(GL11.GL_QUADS);
			GL11.glVertex2f(x, y);
			GL11.glVertex2f(x, y+1);
			GL11.glVertex2f(x+1, y);
			GL11.glVertex2f(x+1, y+1);
		GL11.glEnd();
		GL11.glPopMatrix();
	}
}
